﻿using Kendo.Mvc.Extensions;
using Kendo.Mvc.UI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

using CallCenter.Data;
using CallCenter.Data.BizUtilities;
using System.Configuration;
using System.Data;
using CallCenter.Security;
using CallCenter.Data.Models;
using CallCenter.Data.Misc;

namespace CallCenter.Web.Controllers
{
    public class CompanyHistoryController : BaseController
    {
        // GET: CompanyHistory
        public ActionResult Index()
        {
            return View();
        }

        public ActionResult CompanyHistory()
        {
            CompanyHistoryViewModel cmpy = new CompanyHistoryViewModel();
            return View(cmpy);
        }
        [HttpPost]
        public JsonResult GetCompanyHistory(CompanyHistoryViewModel model,int id)
        {
            model.companyId = id;
            var scratchPads = this.Bridge.CompanyHistoryUtility.GetAll(model.companyId);
            return Json(scratchPads, JsonRequestBehavior.AllowGet);
        }

        [HttpPost]
        public JsonResult DeleteHistory(CompanyHistoryViewModel model)
        {
            //insert items into respective tables
            int id = model.id;
            this.Bridge.CompanyHistoryUtility.Delete(id);
            var returnMessage = "Success";
            return Json(returnMessage, JsonRequestBehavior.AllowGet);

        }

    }
}